<template>
	<view class="container">
		<view class="set-groups">
			<u-cell-group>
				<u-cell-item title="修改登录密码" :arrow="false" @tap="navigateToUpdatepass()">
					<u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon>
				</u-cell-item>
				<u-cell-item :arrow="false" title="修改手机号" value="已绑定1854585851" v-if="isLogin">
					<u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon>
				</u-cell-item>
				<u-cell-item :arrow="false" title="清除缓存" value="">
					<u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon>
				</u-cell-item>
				<u-cell-item :arrow="false" title="地址管理" value="" @tap="navigateToaddress()">
					<u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon>
				</u-cell-item>
				<u-cell-item :arrow="false" title="认证工匠" value="">
					<u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon>
				</u-cell-item>
				<u-cell-item :arrow="false"  title="为我评分" value="">
					<u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon>
				</u-cell-item>
				<u-cell-item :arrow="false" title="推荐朋友" value="">
					<u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon>
				</u-cell-item>
				<u-cell-item :arrow="false"  title="当前版本" value="v1.21">
					<!-- <u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon> -->
				</u-cell-item>
				<u-cell-item :arrow="false"title="客服热线" value="" >
					<u-icon name="/static/icon_zy_189.png" slot="right-icon" size="15"></u-icon>
				</u-cell-item>
			</u-cell-group>
		</view>
		<view class="exit-login" @tap="openExitloginModal()" v-if="isLogin">
			<text>退出登录</text>
		</view>
		<u-modal v-model="showExitloginModal" content="确定要退出登录？" title="温馨提示" confirm-color="#0EAE64" :show-cancel-button="true" cancel-color="#888" @confirm="exitLogin()"></u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showExitloginModal:false,
				isLogin:false
			}
		},
		created() {
			if(uni.getStorageSync('userInfo')){
				this.isLogin=true;
			}else{
				this.isLogin=false;
			}
		},
		methods: {
			exitLogin(){
				uni.clearStorageSync();
				uni.showToast({
					title:'已退出'
				});
				setTimeout(()=>{
					uni.reLaunch({
						url:'/pages/login/login'
					});
				},300);
			},
			openExitloginModal(){
				this.showExitloginModal=true;
			},
			navigateToaddress(){
				if(!this.isLogin){
					uni.showToast({
						icon:'none',
						title:'请先登录'
					});
					return ;
				}
				uni.navigateTo({
					url:`../address/address?mode=${'getlist'}`
				});
			},
			navigateToUpdatepass(){
				if(!this.isLogin){
					uni.showToast({
						icon:'none',
						title:'请先登录'
					});
					return ;
				}
				uni.navigateTo({
					url:'updatepass/updatepass'
				});
			}
		}
	}
</script>

<style lang="scss">
      page{
		  width: 100%;
		  height: 100%;
	  }
	  .container{
		  width: 100%;
		  height: 100%;
		  .set-groups{
			  width: 100%;
			  height: auto;
		  }
		  .exit-login{
			  color: #FFFFFF;
			  width: 680rpx;
			  height: 90rpx;
			  border-radius: 10rpx;
			  background-color: rgba(136,136,136,0.6);
			  text-align: center;
			  line-height: 90rpx;
			  font-size: 28rpx;
			  margin: auto;
			  margin-top:150rpx;
			  margin-bottom: 35rpx;
		  }
	  }
</style>
